<template>
  <div class='page grey-stage'>
  <div ref="my_scroller">
    <div class="container" :style="containerHeight">
      <menu-grid v-if="marketingManage.length" :bar-title="marketingManageTitle" :grid-list="marketingManage"></menu-grid>
      <menu-grid v-if="salesSupport.length" :bar-title="salesSupportTitle" :grid-list="salesSupport"></menu-grid>
    </div>
  </div>
  <crm-tabbar :activeItem='activeItem' v-if="activated"></crm-tabbar>
  </div>
</template>
<script>

  import Vue from 'vue'
  import MenuGrid from '../components/menu-grid';
  import crmTabbar from '../components/crm-tabbar'
  // import Scroller from 'vue-scroller'

  export default{
    data () {
      return {
        containerHeight : 'height:'+document.body.scrollHeight+'px;',
        marketingManageTitle : "销售管理",
        salesSupportTitle: '销售支持',
        marketingManage: [],
        salesSupport: [],
        activated: true,
        activeItem: 'h5marketing'
      }
    },
    components:{
      MenuGrid,
      crmTabbar,
      // Scroller
    },
    activated () {
      this.activeItem = 'h5marketing'
      this.activated = true
    },
    deactivated () {
      this.activated = false
    },
    computed: {
      loginUser () {
        return this.$store.state.app.user
      }
    },
    mounted () {
      let imgServer = this.$store.state.app.imgServer;

      this.marketingManage = [
        {
          icon: imgServer+'normalclient.png',
          text: '社交客户',
          link: {path:'social-client',query:{
            title: '社交客户',
            custom_type:0
          }},
        },

        {
          icon: imgServer+'followrecord.png',
          text: '跟进记录',
          link: {path:'follow-record',query:{
            title: '跟进记录',
            custom_type:0,
            activeItem:'h5marketing'
          }},
        },

        //一期不做
        // {
        //   icon: imgServer+'auditionsign.png',
        //   text: '试听签到',
        //   link: '',
        // },

        {
          icon: imgServer+'redispatchclient.png',
          text: '客户重新分配',
          link:{path:'reassign-client',query:{
            title: '客户重新分配',
            custom_type:0,
            activeItem:'h5marketing',
          }},
          isShow: !!this.loginUser.is_team_manager
        },

        {
          icon: imgServer + 'chachong.png',
          text: '查重',
          link:{path:'cha-chong', query:{
            title: '查重',
            custom_type: 0,
            activeItem: 'h5marketing',
            action: 'search'
          }}
        }
      ]
      this.salesSupport = [
        {
          icon: imgServer+'clientsources.png',
          text: '客户公海',
          link: {path:'client-seas',query:{
            title: '客户公海',
            custom_type : 0,
            activeItem : 'h5marketing'
          }}
        }
      ]
      this.callJsApi('biz.navigation.setTitle',{title:'H5营销'});
    },
  }
</script>
